#include "ui/mainWidget/mainWidget.h"

#include <QApplication>

#include "ENUM/enum.h"
#include "XML/XmlFunc.h"
#include "SPCP/SpcpClass.h"

#include "ReadCameraData/Camerainit.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    XMLFunc::xmlPathInit();
    //QString CongfigXmlPath = QCoreApplication::applicationDirPath() + XMLPATH;      // XMLPATH宏: 定义在enum.h中
    QDomDocument document;
    Language languageValue = Language::Chinese;
    ShowMode showModeValue = ShowMode::DAY;
    QString configVideoImagePath;
    if(XMLFunc::ReadXmlData(XMLFunc::ConfigXmlPath, &document))
    {
        QString congfigLanguage = XMLFunc::ReadElementValue(&document, XMLLanguageKey);
        if(congfigLanguage == "English"){
            languageValue = Language::English;
        }
        QString congfigShowMode = XMLFunc::ReadElementValue(&document, XMLShowModeKey);
        if(congfigShowMode == "Night"){
            showModeValue = ShowMode::NIGHT;
        }
        qDebug() << congfigShowMode  << " " << congfigLanguage;
    }

    mainWidget w(&a, languageValue, showModeValue);
    w.resize(1050, 480);
    w.show();

    return a.exec();

   /* CameraInit Camera(1080, 1920, 3);
   while(1)
   {
       if(DataToImageThread::m_IsRead)
       {
           qDebug() << DataToImageThread::m_image;
       }
       Sleep(1);
   }*/
}
